package service

import (
	"github.com/PhlexTheCharr/gofurry-cloud-service/apps/openlist/manage/log/dao"
	"github.com/PhlexTheCharr/gofurry-cloud-service/apps/openlist/manage/log/models"
	"github.com/PhlexTheCharr/gofurry-cloud-service/common"
	cm "github.com/PhlexTheCharr/gofurry-cloud-service/common/models"
	"github.com/PhlexTheCharr/gofurry-cloud-service/common/util"
	"time"
)

type manageLogService struct{}

var manageLogSingleton = new(manageLogService)

func GetManageLogService() *manageLogService { return manageLogSingleton }

// 新增管理日志
func (svc *manageLogService) AddManageLog(logType string, info string) common.GFError {
	var newLog = &models.GfcLog{
		ID:         util.GenerateId(),
		Type:       logType,
		Detail:     info,
		CreateTime: cm.LocalTime(time.Now()),
	}
	err := dao.GetManageLogDao().Add(newLog)
	return err
}
